<template>
  <div>
    <div class="page_title">常用功能</div>
    <div class="page_body">
      <div v-for="(item, index) in routerList" :key="index">
        <div class="box_item" @click="gotoPage(item)">
          <div class="icon_box">
            <svg-icon :icon-class="item.icon ? item.icon : 'schedule-all'" :style="{ color: item.color }" />
          </div>
          <div class="title">{{ item.title }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
  
<script setup lang="ts">
import { reactive } from 'vue';
import { useRouter } from 'vue-router'; // 引入 useRouter

const router = useRouter(); // 获取路由实例

const routerList = reactive([
  { title: '我的收藏', icon: 'collect-fill', path: '/newUi/networkDisk/my-collect', color: '#ffdc53' },
  { title: '我的标签', icon: 'tags', path: '/newUi/networkDisk/my-tag', color: '#73d897' },
  { title: '高级检索', icon: 'search', path: '/newUi/networkDisk/expert-search', color: '#57faca' },
  { title: '分发接收', icon: 'shuffle', path: '/newUi/networkDisk/distribution-reception', color: '#5598ff' }
]);

const gotoPage = (item: any) => {
  router.push(item.path);
};
</script>
  
<style scoped lang='scss'>
.page_body {
  display: flex;
  // flex-wrap: wrap;
  justify-content: space-between;
}
.page_title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 5px;
}
.box_item {
  width: 108px;
  text-align: center;
  padding: 12px 0;
  cursor: pointer;
  margin-right: 6px;

  &:hover {
    background-color: #ecf5ff;
    border-radius: 4px;
  }

  .icon_box {
    font-size: 40px;
  }

  .title {
    color: #1f2329;
    margin-top: 9px;
  }
}
</style>